﻿using System;
using System.Data;
using System.Web.UI;
using System.Xml;
using VitCode.BaseDataPageCreator.Setting;
using VitCode.Castle.DataAccess;
using VitCode.Castle.Management;


namespace VitCode.Web.MainWebForm
{
    public partial class Index : VcPage
    {
        private const string COUNTER = "App_Counter";

        protected void Page_Load(object sender, EventArgs e)
        {

            if (!IsPostBack)
            {
                
                labOnLineCount.Text = LogicUserAmountHelper.GetLogicUserAmount()+ "人";


                if (!String.IsNullOrEmpty(GenericContext.CurrUserName))
                {
                    labLoginUser.Text = Server.UrlDecode(GenericContext.CurrUserName);
                }
                string userCode = GenericContext.CurrUserCode;
                if (!String.IsNullOrEmpty(userCode))
                {

                }
                else
                {
                    Response.Redirect("../Default.aspx");
                }


                string xmlFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\MainWebForm\\VerSetting.xml"; //XML檔路徑
                var xmlObj = new XmlDocument();
                xmlObj.Load(xmlFilePath);
                var ds = new DataSet();
                ds.ReadXml(xmlFilePath);
                if (ds.Tables != null && ds.Tables[0].Rows.Count > 0)
                {
                    labVerValue.Text =ds.Tables[0].Rows[0]["Version"].ToString();
                }


            }

        }
    }
}

